#include "lagoon-audio-overlay.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/linux-event-codes.h>
#include <dt-bindings/iio/qcom,spmi-vadc.h>
#include "lagoon-sde-display.dtsi"
#include "lagoon-thermal-overlay.dtsi"

&soc {
	gpio_keys {
		compatible = "gpio-keys";
		label = "gpio-keys";

		pinctrl-names = "default";
		pinctrl-0 = <&key_vol_up_default>;

		vol_up {
			label = "volume_up";
			gpios = <&pm6350_gpios 2 GPIO_ACTIVE_LOW>;
			linux,input-type = <1>;
			linux,code = <KEY_VOLUMEUP>;
			gpio-key,wakeup;
			debounce-interval = <15>;
			linux,can-disable;
		};
	};
};

&pm6350_gpios {
	key_vol_up {
		key_vol_up_default: key_vol_up_default {
			pins = "gpio2";
			function = "normal";
			input-enable;
			bias-pull-up;
			power-source = <0>;
		};
	};
};

&qupv3_se10_i2c {
	status = "disabled";
};

&pm8008_8 {
	status = "disabled";
};

&pm8008_9 {
	status = "disabled";
};

&pm6150a_amoled {
	status = "ok";
};

&pm7250b_charger {
	status = "ok";
	io-channels = <&pm7250b_vadc ADC_USB_IN_V_16>,
		      <&pm7250b_vadc ADC_USB_IN_I>,
		      <&pm7250b_vadc ADC_CHG_TEMP>,
		      <&pm7250b_vadc ADC_DIE_TEMP>,
		      <&pm7250b_vadc ADC_AMUX_THM3_PU2>,
		      <&pm7250b_vadc ADC_SBUx>,
		      <&pm7250b_vadc ADC_VPH_PWR>;
	io-channel-names = "usb_in_voltage",
			   "usb_in_current",
			   "chg_temp",
			   "die_temp",
			   "conn_temp",
			   "sbux_res",
			   "vph_voltage";
	qcom,batteryless-platform;
	qcom,sec-charger-config = <0>;
	qcom,auto-recharge-soc = <98>;
	qcom,step-charging-enable;
	qcom,sw-jeita-enable;
	qcom,charger-temp-max = <800>;
	qcom,smb-temp-max = <800>;
	qcom,suspend-input-on-debug-batt;
};

&pm7250b_qg {
	status = "ok";
	io-channels = <&pm7250b_vadc ADC_BAT_THERM_PU2>,
		      <&pm7250b_vadc ADC_BAT_ID_PU2>;
	io-channel-names = "batt-therm",
			   "batt-id";
	qcom,qg-iterm-ma = <150>;
	qcom,hold-soc-while-full;
	qcom,linearize-soc;
	qcom,cl-feedback-on;
};

&ufsphy_mem {
	compatible = "qcom,ufs-phy-qmp-v3";

	vdda-phy-supply = <&L18A>;
	vdda-pll-supply = <&L22A>;
	vdda-phy-max-microamp = <62900>;
	vdda-pll-max-microamp = <18300>;

	status = "ok";
};

&ufshc_mem {
	vdd-hba-supply = <&gcc_ufs_phy_gdsc>;
	vdd-hba-fixed-regulator;
	vcc-supply = <&L7E>;
	vcc-voltage-level = <2950000 2960000>;
	vccq2-supply = <&L12A>;
	vccq2-voltage-level = <1800000 1800000>;
	vcc-max-microamp = <800000>;
	vccq2-max-microamp = <800000>;
	vccq2-pwr-collapse-sup;

	qcom,vddp-ref-clk-supply = <&L22A>;
	qcom,vddp-ref-clk-max-microamp = <100>;
	qcom,vddp-ref-clk-min-uV = <1152000>;
	qcom,vddp-ref-clk-max-uV = <1200000>;
	status = "ok";
};

&sdhc_1 {
	vdd-supply = <&L7E>;
	qcom,vdd-voltage-level = <2960000 2960000>;
	qcom,vdd-current-level = <0 570000>;

	vdd-io-supply = <&L12A>;
	qcom,vdd-io-always-on;
	qcom,vdd-io-lpm-sup;
	qcom,vdd-io-voltage-level = <1800000 1800000>;
	qcom,vdd-io-current-level = <0 325000>;

	pinctrl-names = "active", "sleep";
	pinctrl-0 = <&sdc1_clk_on &sdc1_cmd_on &sdc1_data_on
					&sdc1_rclk_on>;
	pinctrl-1 = <&sdc1_clk_off &sdc1_cmd_off &sdc1_data_off
					&sdc1_rclk_off>;

	status = "ok";
};

&sdhc_2 {
	vdd-supply = <&L9E>;
	qcom,vdd-voltage-level = <2960000 2960000>;
	qcom,vdd-current-level = <0 800000>;

	vdd-io-supply = <&L6E>;
	qcom,vdd-io-voltage-level = <1800000 2950000>;
	qcom,vdd-io-current-level = <0 22000>;

	pinctrl-names = "active", "sleep";
	pinctrl-0 = <&sdc2_clk_on  &sdc2_cmd_on &sdc2_data_on &sdc2_cd_on>;
	pinctrl-1 = <&sdc2_clk_off &sdc2_cmd_off &sdc2_data_off &sdc2_cd_off>;

	cd-gpios = <&tlmm 94 GPIO_ACTIVE_LOW>;

	status = "ok";
};

&dsi_rm69299_visionox_amoled_video {
	qcom,panel-supply-entries = <&dsi_panel_pwr_supply>;
	qcom,mdss-dsi-bl-pmic-control-type = "bl_ctrl_dcs";
	qcom,mdss-dsi-bl-min-level = <1>;
	qcom,mdss-dsi-bl-max-level = <255>;
	qcom,platform-te-gpio = <&tlmm 23 0>;
	qcom,platform-reset-gpio = <&pm6150l_gpios 9 0>;
};

&dsi_rm69299_visionox_amoled_cmd {
	qcom,panel-supply-entries = <&dsi_panel_pwr_supply>;
	qcom,mdss-dsi-bl-pmic-control-type = "bl_ctrl_dcs";
	qcom,mdss-dsi-bl-min-level = <1>;
	qcom,mdss-dsi-bl-max-level = <255>;
	qcom,platform-te-gpio = <&tlmm 23 0>;
	qcom,platform-reset-gpio = <&pm6150l_gpios 9 0>;
};

&dsi_sim_cmd {
	qcom,panel-supply-entries = <&dsi_panel_pwr_supply_no_labibb>;
	qcom,mdss-dsi-bl-pmic-control-type = "bl_ctrl_dcs";
	qcom,platform-reset-gpio = <&pm6150l_gpios 9 0>;
};

&dsi_sim_vid {
	qcom,panel-supply-entries = <&dsi_panel_pwr_supply_no_labibb>;
	qcom,mdss-dsi-bl-pmic-control-type = "bl_ctrl_dcs";
	qcom,platform-reset-gpio = <&pm6150l_gpios 9 0>;
};

&sde_dsi {
	qcom,dsi-default-panel = <&dsi_rm69299_visionox_amoled_video>;
};

&qupv3_se0_i2c {
	status = "ok";
	#address-cells = <1>;
	#size-cells = <0>;
	nq@28 {
		compatible = "qcom,nq-nci";
		reg = <0x28>;
		qcom,nq-irq = <&tlmm 9 0x00>;
		qcom,nq-ven = <&tlmm 6 0x00>;
		qcom,nq-firm = <&tlmm 8 0x00>;
		qcom,nq-clkreq = <&tlmm 7 0x00>;
		interrupt-parent = <&tlmm>;
		interrupts = <9 0>;
		interrupt-names = "nfc_irq";
		pinctrl-names = "nfc_active", "nfc_suspend";
		pinctrl-0 = <&nfc_int_active &nfc_enable_active
				&nfc_clk_req_active>;
		pinctrl-1 = <&nfc_int_suspend &nfc_enable_suspend
				&nfc_clk_req_suspend>;
	};
};

&qupv3_se8_i2c {
	status = "okay";
	qcom,i2c-touch-active="synaptics,tcm-i2c";

	synaptics_tcm@20 {
		compatible = "synaptics,tcm-i2c";
		reg = <0x20>;
		interrupt-parent = <&tlmm>;
		interrupts = <22 0x2008>;
		pinctrl-names = "pmx_ts_active","pmx_ts_suspend",
					"pmx_ts_release";
		pinctrl-0 = <&ts_active>;
		pinctrl-1 = <&ts_int_suspend &ts_reset_suspend>;
		pinctrl-2 = <&pmx_ts_release>;
		vdd-supply = <&L11A>;
		avdd-supply = <&L6A>;
		synaptics,pwr-reg-name = "avdd";
		synaptics,bus-reg-name = "vdd";
		synaptics,irq-gpio = <&tlmm 22 0x2008>;
		synaptics,irq-on-state = <0>;
		synaptics,reset-gpio = <&tlmm 21 0x00>;
		synaptics,reset-on-state = <0>;
		synaptics,reset-active-ms = <20>;
		synaptics,reset-delay-ms = <200>;
		synaptics,power-delay-ms = <200>;
		synaptics,ubl-i2c-addr = <0x20>;
		synaptics,extend_report;
		synaptics,firmware-name = "synaptics_firmware.img";

		panel = <&dsi_rm69299_visionox_amoled_video
			&dsi_rm69299_visionox_amoled_cmd>;
	};
};

&sde_dp {
	status = "disabled";
};

&mdss_dp_pll {
	status = "disabled";
};

&mdss_mdp {
	connectors = <&sde_wb &sde_dsi &sde_rscc>;
};
